<template>
  <el-dialog
    :close-on-click-modal="false"
    :title="编辑"
    :visible.sync="visible">
  </el-dialog>
</template>

<script>

import jmxToObject from '@/utils/jmxToObject'

export default {
  data() {
    return {
      visible: false,
      dataList: {}
    }
  },

  methods: {
    init(fileName) {
      this.$http({
        url: this.$http.adornUrl('/testReport/' + fileName),
        method: 'get',
      }).then(({data}) => {
        console.log('结果是',data)
        console.log(typeof(data)) 
        let reponse = jmxToObject.getChidrenXML(data)
        console.log(reponse)
      }).then(() => {
        this.visible = true
        this.$nextTick(() => {
          // this.$refs['dataForm'].resetFields()
        })
      })
    },
    // 表单提交
    dataFormSubmit() {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          this.$http({
            url: this.$http.adornUrl(`/test/stress/${!this.dataForm.id ? 'save' : 'update'}`),
            method: 'post',
            data: this.$http.adornData({
              'caseId': this.dataForm.id || undefined,
              'caseName': this.dataForm.caseName,
              'module': this.dataForm.module,
              'operator': this.dataForm.operator,
              'project': this.dataForm.project,
              'remark': this.dataForm.remark
            })
          }).then(({data}) => {
            if (data && data.code === 0) {
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.visible = false
                  this.$emit('refreshDataList')
                }
              })
            } else {
              this.$message.error(data.msg)
            }
          })
        }
      })
    },

  }
}
</script>

<style scoped>

</style>
